<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Cache
 *
 * @author PLeblanc
 */
class Qp_Cache {

    public static $driver;

    public static function setupDbCache() {

        switch(Qp_Setup::CACHE)
        {
            case 'Db':
                $cacheConn = Doctrine_Manager::connection(new PDO('sqlite:Compiled/db_cache_file'));
                $cacheDriver = new Doctrine_Cache_Db(array('connection' => $cacheConn,'tableName' => Qp_Setup::DB_TABLE_PREFIX . 'db_cache'));
                if(!$cacheConn->hasTable(Qp_Setup::DB_TABLE_PREFIX . 'db_cache'))
                    $cacheDriver->createTable();
                self::$driver = $cacheDriver;
                break;
            case 'Apc':
                self::$driver =  new Doctrine_Cache_Apc();
                break;
        }
    }
}
?>
